﻿import QtQuick 2.0

Rectangle {
    id: levelScreen
    scale: 0

    color: Qt.rgba(216/255, 148/255, 49/255, 1)
    border.color: Qt.rgba(120/255, 70/255, 0, 1)
    border.width: 5

    width: 800
    height: 600

    Keys.onBackPressed: {
        if(window.tempNewI>=13 || window.clear)
            return
        levelScreen.scale = 0
        bStartGame = true
        rectBgMain.focus = true
    }

    Behavior on scale {
        SpringAnimation{
            damping: 0.9
            spring: 5
        }
    }

    GridView{
        id: gridView
        width: 110*7
        height: 110*5
        clip: true
        anchors.centerIn: parent
        model: 50
        cellHeight: 110
        cellWidth: 110
        delegate: Rectangle{
            radius: 10
            color: "white"
            width: 100
            height: 100
            Text {
                id: text
                text: Number(index)+1
                anchors.centerIn: parent
                font.pointSize: 20
                font.family: "微软雅黑"
                font.bold: true
            }
            MouseArea{
                anchors.fill: parent
                onClicked: {
                    levelScreen.scale = 0

                    canPress = true
                    bStartGame = true
                    rectBgMain.focus = true

                    score = 0

                    level.ready(Number(text.text))
                }
            }
        }
    }

    Image{
        anchors.right: parent.right
        anchors.rightMargin: -width/2
        y: -height/2
        source: "qrc:/img/img/close.png"
        MouseArea{
            anchors.fill: parent
            onClicked: {

                if(window.tempNewI>=13 || window.clear)
                    return

                levelScreen.scale = 0

                bStartGame = true
                rectBgMain.focus = true
            }
        }
    }
}
